// query/pages/search/search.js
const options = [
  {
    text: '浙江省',
    value: '330000',
    children: [{ text: '杭州市', value: '330100' }],
  },
  {
    text: '江苏省',
    value: '320000',
    children: [{ text: '南京市', value: '320100' }],
  },
];
Page({
  data: {
    show: false,
    options,
    fieldValue: '',
    cascaderValue: '',
    columns: ['一级咨询师', '二级咨询师', '三级咨询师'],
    showLevel: false,
    level: ''
  },

  onClick() {
    this.setData({
      show: true,
    });
  },

  onClose() {
    this.setData({
      show: false,
    });
  },

  onFinish(e) {
    const { selectedOptions, value } = e.detail;
    const fieldValue = selectedOptions
      .map((option) => option.text || option.name)
      .join('/');
    this.setData({
      fieldValue,
      cascaderValue: value,
    })
  },
  onClickLeft() {
    wx.navigateBack()
  },
  select() {
    this.setData({
      showLevel: true,
    });
  },
  onConfirm(event) {
    const { picker, value, index } = event.detail;
    this.setData({
      showLevel: false,
      level: value
    });
    console.log(`当前值：${value}, 当前索引：${index}`)
  },
  goResult() {
    wx.navigateTo({
      url: '../searchResult/searchResult',
    })
  },
  tagSelect(value) {
     let arr = []
     arr.push(value)
     console.log(arr);
  }
});
